//
//  YMNetworkManager+Extension.swift
//  Driver
//
//  Created by lantaiyuan on 2017/9/22.
//  Copyright © 2017年 youmy. All rights reserved.
//

import Foundation

extension YMNetworkManager {
    /// 登录
    ///
    /// - Parameters:
    ///   - userName: 用户名
    ///   - password: 密码
    ///   - completion: 回调
    func login(userName: String,
               password: String, completion:@escaping (_ dict: [String: AnyObject]?, _ isSuccess: Bool)->()) -> () {
        
        let urlString = http_server + "/login/userLogin"
        let params = ["username":userName, "password":password] as [String: AnyObject]
        
        request(method: .POST, URLString: urlString, params: params) { (json, isSuccess) in
            completion(json as? [String: AnyObject], isSuccess)
        }
    }
    
}
